import java.util.Arrays;

public class Solution561 {
    public int arrayPairSum(int[] nums) {
        Arrays.sort(nums);
        int ans=0;
        for (int i=0;i<nums.length;i+=2){
            ans=ans+nums[i];
        }
        return ans;
    }

    public static void main(String[] args) {
        System.out.println(new Solution561().arrayPairSum(new int[]{1,4,3,2}));
    }
}
